import time
import datetime
from python_baway.common.xcommon import sep

FMTWithMicro = '%Y-%m-%d %H:%M:%S.%f'

sep('timestamp')
xnowts = time.time()
print(time.ctime(xnowts))

sep('dt from timestamp')
xnowdt = datetime.datetime.fromtimestamp(xnowts)
print(xnowdt.ctime())

sep('format')
xnowdt_str = xnowdt.strftime(FMTWithMicro)
print(xnowdt_str)

sep('parse')
xnowdt2 = datetime.datetime.strptime(xnowdt_str, FMTWithMicro)
xnowdt2_str = xnowdt2.strftime(FMTWithMicro)
print(xnowdt2_str)
